import { ApiCall } from "tsrpc";
import { ReqDestroy, ResDestroy } from "../../../../shared/master/body/skill/PtlDestroy";
import { player } from "../../../../model/fight/body/player";
import { template } from "../../../../shared/master/MsgAction";

export default async function (call: ApiCall<ReqDestroy, ResDestroy>) {
    call.succ({})
    let user = call.req._player as player;
    let idx = call.req.idx;
    let sk_body = user.getSkill_body();
    let item = sk_body[idx - 1]
    if(!item){
        user.sendMsg(template.default,`未找到自身学习且ID为${idx}的技能`)
        return;
    }
    
    user.sendMsg(template.default,`技能:${item.rename}已遗忘.`)
    user.delSkill(idx - 1);
    item.destroy();
}